from pydantic_settings import BaseSettings
from dotenv import load_dotenv

load_dotenv()  # 加载.env文件中的环境变量


class Settings(BaseSettings):
    test_url: str
    token_secret: str


settings = Settings()

# 不登录的情况下，允许访问的api
allow_routes: list[str] = [
    "/test",
    "/static",
    "/user/login",
    "/user/register"
]

# token签名密钥(openssl rand -hex 32 生成32位随机字符串)
# token_secret = "01e37dd2508d5bcfd5b53fbaa8ea6f29906b04d5896125e52499b05609ddd5cf"

TORTOISE_ORM = {
    "connections": {
        "default": "sqlite://data/fastapi-demo.sqlite3",
    },
    "apps": {
        "models": {
            "models": [
                "model.all_models",
                # 如果使用aerich数据库迁移工具的话，需要增加这一行
                # "aerich.models"
            ],  # 这里可以添加多个模型路径, aerich.models必须要带着
            "default_connection": "default",
        }
    }
}
